FIG. 8A and FIG. 8B show configuration of a network system based on a duplex transmission system respectively. In this network, network units 20.sub.1 to 20.sub.4 are connected to four units of programmable controller (described PC hereinafter) 10.sub.1 to 10.sub.4 respectively, and the network units 20.sub.1 to 20.sub.4 are connected to each other with a duplex loop consisting of a main loop transmission path 30 and an auxiliary loop transmission path 40.
Of the network units 20.sub.1 to 20.sub.4, a network unit 20.sub.1 functions as an administrative station, and in the following description the network controller 20.sub.1 is sometimes described as a network manager (abbreviated as NM). In contrast, network units 20.sub.2 to 20.sub.4 are normal stations, and in the following description the network units 20.sub.2 to 20.sub.4 are sometimes described as a network controller (abbreviated as NC).
The NM 20.sub.1 not only transmits signals to and receives signals from each of the PCs 10.sub.1 to 10.sub.4 but also transmits network parameters as to how many stations the network comprises, what type of communications is to be executed or the like to the NCs 20.sub.2 to 20.sub.4, and checks whether the network is operating correctly or not, while the NCs 20.sub.2 to 20.sub.4 transmit signals to and receive signals from the PCs 10.sub.1 to 10.sub.4 under management by the NC 20.sub.1.
The difference between the NM 20.sub.1 and NCs 20.sub.2 to 20.sub.4 is whether software mainly relating to a network management function has been installed therein or not, and the hardware configuration is identical.
FIG. 9 shows hardware configuration of a programmable controller having a network communication function. The PC 10 (PCs 10.sub.1 to 10.sub.4) comprises a CPU 11 executing sequence processing or processing for communications with the network unit 20 (NMs 20.sub.1, NCs 20.sub.2 to 20.sub.4) or the like, a ROM 12 for storing a sequence program or a control program therein, a RAM 22 as a work memory handling various types of data, and external interface (I/F) 14 such as external input/output, serial interface, an LED, or a switch.
The network unit 20 comprises a CPU 21 executing communications with other stations or communication with the PC 10 for the network manager, a two-port RAM 22 which is a memory exchanging data or executing handshaking with the PC 10 for the network manager, a ROM 23 for storing therein processing programs such as communication programs, a RAM 24 as a work memory handling various types of data, and a network interface 25 connected to other stations with duplex loop configuration.
Connected to the network interface 25 are a main loop transmission cable 31 and a main loop receiving cable 32 each constituting a main transmission path 30, and an auxiliary loop transmission cable 41 and an auxiliary loop receiving cable 42 each constituting an auxiliary loop transmission path 40. Each of these cables is a two-core pair cable consisting of an optical cable or the like, and the main loop transmission cable 31 forms a pair with the auxiliary loop receiving cable 42, and the auxiliary loop transmission cable 41 forms a pair with the main loop receiving cable 32.
FIG. 10 shows an example of memory configuration of transmission/receiving interface in the two-port RAM 22 of the conventional network unit 20. The two-port RAM 22 comprises a transmission/receiving start flag area for storing therein a transmission/receiving start flag indicating whether an NM or an NC is ready for communications with other stations or not, a status area for storing a status indicating abnormality when transmission/receiving is stopped, a network parameter area for storing network parameters indicating how many stations the network comprise, what type of communications is to be executed, or the like, a transmit buffer for transmission from a PC, a receive buffer for receiving from an NM or an NC, each allocated therein.
Next description is made for operations in the conventional type of network.
At first description is made for the processing performed by the PC 10 with reference to FIG. 11. The PC 10 executes the initial processing for checking whether the RAM 13, external I/F 14, and network unit 20 are operating correctly or not (step ST141), whether the connected network unit 20 is a network manager or a network controller (step ST142).
As the network unit connected to the PC 10.sub.1 is a network manager (NM 20.sub.1), the PC 10.sub.1 executes network parameter transmission processing for writing network parameters in a network parameter area of the two-port RAM 22 (step ST143). Then the network manager monitors the transmission/receiving start flag area of the two-port RAM 22, and determines whether transmission or receiving has been started or not according to whether the transmission/receiving start flag has been turned ON or not (step ST145).
If transmission or receiving has been started (step ST145 affirmative), transmission to or receiving from other stations is executed through a transmit buffer or a receive buffer allocated to the two-port RAM 22. Then the network manager executes processing for sequence control which is to be executed by a PC (step ST149).
On the contrary, if it is determined that the transmission/receiving flag has been turned OFF (step ST145 negative), the network manager checks contents of the status area of the two-port RAM 22 (step ST147), and if any abnormality is detected (step ST147 affirmative), appropriate processing for troubleshooting is executed (step ST148), and then executed is the sequence control processing to be executed by a PC (step ST149), and on the other hand if any abnormality is not detected (step ST147 negative), the network manager immediately executes the sequence control processing which is originally to be executed by a PC (step ST149).
If the sequence control processing is finished, system control returns to step ST145, and by repeating the processing sequence, the network manager executes sequence control as well as transmission to or receiving from other stations.
As the network controllers (NC 10.sub.2 to 10.sub.4) are connected to the PCs 10.sub.2 to 10.sub.4 respectively, in the PCs 10.sub.2 to 10.sub.4, a controller is selected according to a result of determination in step ST142, network parameters are fetched from the network parameter area of the two-port RAM 22 (step ST144). Then, like in the PC 10.sub.1, processing is executed successively from the step ST145, and like in the PC 10.sub.1, sequence control as well as transmission to or receiving from other stations are executed.
Next description is made for operations of the network manager (NM) 20 with reference to a flow chart shown in FIG. 12.
The NM 20.sub.1 executes the initial processing such as checking whether the network I/F 25 is operating correctly or not (step ST100), and sets the transmission/receiving start flag stored in the transmission/receiving start flag area of the two-port RAM 22 to OFF (step ST101).
Then the NM 20.sub.1 makes determination as to whether both the main and auxiliary loop cables are available for communication with other stations due to disconnection of a line or not (step ST102), and if it is determined that the line is not available for communication with other stations due to a failure such as disconnection of the line or for other reason (step ST102 affirmative), the NM 20.sub.1 sets a line disconnection fault in the status area of the two-port RAM 22 (step ST106), also sets the transmission/receiving start flag in the two-port RAM 22 to OFF (step ST107), and repeats the processing sequence from step ST102 until the line is recovered to the normal state.
If it is determined that the status is normal (step ST102 negative), the network parameters stored in the network parameter area of the two-port RAM 22 are transmitted from the PC 10.sub.1 to other stations (step ST104).
Then, to inform the PC 10.sub.1 of the fact that communication with other stations has been started, the transmission/receiving start flag of the two-port RAM 22 is set to ON (step ST105).
Then whether a request for transmission has been issued from the PC 10.sub.1 or not is checked in the transmit buffer of the two-port RAM 22 (step ST108), and if it is determined that a request for transmission has been issued (step ST108 affirmative), processing for transmission is executed (step ST109), and if it is determined that a request for transmission has not been issued (step ST108 negative), transmission processing is not executed, and system control shifts to step ST110.
Then checking is made as to whether a transmission frame has been received from other stations or not (step ST110), and if it is determined that a transmission/receiving frame has been received (step ST110 affirmative), the receiving processing for setting the received data in a receive buffer of the two-port RAM 22 is executed (step ST111), and if it is determined that any transmission frame has not been received from other stations (step ST110 negative), the processing for receiving is not executed, and system control shifts to step ST112.
Also checking is made as to whether any abnormality has been generated due to a failure such as disconnection of a line during transmission or receiving or not (step ST112), and if it is determined that any abnormality has not been generated (step ST112 negative), then system control returns to step ST108, and if it is determined that any abnormality has been generated (step ST112 affirmative), a flag indicating a line disconnection fault is set in the status area of the two-port RAM 22 (step ST106) with the transmission/receiving start flag in the two-port RAM 22 set to OFF (step ST107), and the processing sequence from the step ST102 is repeated until the line is recovered to the normal state.
Then description is made for operations of the network controllers (NC) 20.sub.2 to 20.sub.4 with reference to the flow chart shown in FIG. 13.
The network controllers 20.sub.2 to 20.sub.4 execute the initial processing such as checking as to whether the RAM 24 and network I/F 25 are operating correctly or not (step ST120), and set the transmission/receiving start flag stored in the transmission/receiving start flag area of the two-port RAM 22 to OFF (step ST121).
Then the network controllers check whether both the main and auxiliary loop lines are unavailable for communications with other stations due to such a failure as disconnection of a line or not (step ST122), and if it is determined that communication with other stations can not be executed due to such a failure as disconnection of a line (step ST122 affirmative), the network controllers set a flag indicating line disconnection fault in the status area of the two-port RAM 22 (step ST125) and also set the transmission/receiving start flag in the two-port RAM 22 to OFF (step ST126), and repeats the processing sequence from the step ST122 until the line is restored to the normal state.
If it is determined that the lines are in the normal state (step ST122 negative), the network controllers check whether network parameters from the NM 20.sub.1 have been received or not (step ST124), and if it is determined that the parameters have not been received yet (step ST124 negative), then system control returns to step ST122.
On the contrary, if it is determined that the parameters have been received (step ST124 affirmative), the network controllers execute the network parameter receiving processing for storing the network parameters in the network parameter area of the two-port RAM 22, and deliver the parameters to a PC connected to each of the network controllers (step ST127).
Then to report the fact that communication with other stations has been started to the PC connected to each network controller, the transmission/receiving start flag in the two-port RAM 22 is set to ON (step ST128).
Then the network controllers check whether a transmission frame has been received from other stations or not (Step ST129), and if it is determined that a transmission frame has been received (step ST122 affirmative), the network controllers execute the receiving processing for setting the received data in the receive buffer of the two-port RAM 22 (step ST130), and if it is determined that a transmission frame has not been received (step ST129 negative), the network controllers do not execute the receiving processing, and system control shifts to the step ST131.
Then the network controllers check whether a request for transmission has been issued from a PC connected to each of the network controllers by checking the transmit buffer of the two-port RAM 22 (step ST131), and if it is determined that a request for transmission has been issued (step ST131 affirmative), then network controllers execute the transmitting processing (step ST132), and if it is determined that a request for transmission has not been issued (step ST131 negative), the network controllers do not execute the transmitting processing with the system control shifted to the step ST133.
Then the network controllers check whether any abnormality has been generated due to such a failure as disconnection of a line during the communications described above or not (step ST133), and if it is determined that the line is in the normal state (step ST133 affirmative), system control returns to the step ST129, and if it is determined that any abnormality has been generated, the network controllers set a flag indicating a line disconnection fault in the status area of the two-port RAM 22, set the transmission/receiving start flag in the two-port RAM 22 to OFF (step ST126), and repeat the processing sequence from the step ST122 until the line is restored to the normal state.
In the conventional type of network system, checking is not executed as to through which of a main loop and an auxiliary loop a transmission frame has been received, and for this reason, as shown in FIG. 8B, even if a pair cable A between the NC 20.sub.3 and NC 20.sub.4, consisting of a main loop transmission cable 31 and an auxiliary receiving table 42 and a pair cable B between the NC 20.sub.4 and NM 20.sub.1 consisting of an auxiliary transmission cable 41 and a main receiving cable 32 are connected to the NC 20.sub.4 erroneously, it can not be detected.
Even if the detection is impossible, not error is generated in the conventional system as described above, and normal communications can be executed, so that any problem does not occur, but generally in communications based on duplex loop configuration, if a main loop is disconnected, communication is executed only through the auxiliary loop. Also it is well known that, if power supply for any station is disconnected, a fail-safe function enabling loop back in stations before and behind the failed station is used.
Such functions as described above naturally assume that the main and auxiliary loops are connected correctly, and if there are erroneous connections at a plurality of sections, such a problems as that the loop-back function does not work correctly occurs.
For this reason, to check that the main and auxiliary loops are connected correctly, markings are provided on cables or at the necessary places when the system is constructed, and visual checking for the markings is required, which is troublesome.